package com.zhengdongzulin.zuke.app.main.mine

import androidx.lifecycle.rxLifeScope
import com.lxj.androidktx.livedata.StateLiveData
import com.zhengdongzulin.zuke.app.Api
import com.zhengdongzulin.zuke.app.data.AboutUs
import com.zhengdongzulin.zuke.base.BaseViewModel
import rxhttp.wrapper.param.RxHttp
import rxhttp.wrapper.param.toResponse

class AboutUsVm : BaseViewModel() {

    var getAboutDetail: StateLiveData<AboutUs> = StateLiveData()

    fun getAboutDetail() {
        rxLifeScope.launch(
            {
                var r = RxHttp.postJson(Api.GET_ABOUT_DETAIL)
                    .toResponse<AboutUs>()
                    .await()
                getAboutDetail.postValueAndSuccess(r)
            }, {
                assignment(it, getAboutDetail)
            }
        )
    }

}